﻿@model MultiChoiceVoting.Models.MultiChoiceVotingPart
@{
    bool isNewRecord = Model.Id == 0;
}
<fieldset>
    <legend>@T("Multi-Choice Voting Settings")</legend>
    <ol>
        <li>
            @Html.LabelFor(model => model.Name, T("Name"))
            @Html.TextBoxFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
            <span class="hint">@T("The name of the voting.")</span>
        </li>
        <li>
            @Html.LabelFor(model => model.Question, T("Question"))
            @Html.TextBoxFor(model => model.Question)
            @Html.ValidationMessageFor(model => model.Question)
        </li>
        @if (isNewRecord)
        {
            <li>
                @Html.LabelFor(model => model.AnswerList, T("Answers"))
                @Html.TextAreaFor(model => model.AnswerList)
                @Html.ValidationMessageFor(model => model.AnswerList)
            <span class="hint">@T("Write down the answers on seperarate lines.")</span>
            </li>
        }
        <li>
            @Html.LabelFor(model => model.Comment, T("Comment"))
            @Html.TextAreaFor(model => model.Comment)
        </li>
        <li>
            @Html.LabelFor(model => model.ReleaseDate, T("Release Date"))
            @Html.TextBoxFor(model => model.ReleaseDate)
        </li>
        <li>
            @Html.LabelFor(model => model.FinishDate, T("Finish Date"))
            @Html.TextBoxFor(model => model.FinishDate)
        </li>
        <li>
            @Html.LabelFor(model => model.IsActive, T("Active voting?"))
            @Html.CheckBoxFor(model => model.IsActive)
        </li>
    </ol>
    @if (!isNewRecord)
    {
        <table class="items" summary="@T("This is a table of the answers corresponding to the question you selected.")">
            <thead>
                <tr>
                    <th>@T("Text")</th>
                    <th>@T("Vote count")</th>
                </tr>
            </thead>
            <tbody>
                @if (Model.Answers != null)
                {
                    foreach (var answer in Model.Answers)
                    {
                    <tr>
                        <td>
                            @answer.Text
                        </td>
                        <td>
                            @answer.VoteCount
                        </td>
                    </tr>
                    }
                }
            </tbody>
        </table>
    }
</fieldset>

